<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;


/**
 * App\Models\MoneyLog
 *
 * @property int $id
 * @property int $user_id 用户id
 * @property string $name 资金记录名称
 * @property float $money 变动金额
 * @property string $type 奖金类型
 * @property int $change_type 变动类型:true-增加，false-减少
 * @property string $order_no 关联订单号
 * @property int $buy_user 购买人
 * @property \Carbon\Carbon|null $created_at
 * @property \Carbon\Carbon|null $updated_at
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\MoneyLog whereBuyUser($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\MoneyLog whereChangeType($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\MoneyLog whereCreatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\MoneyLog whereId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\MoneyLog whereMoney($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\MoneyLog whereName($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\MoneyLog whereOrderNo($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\MoneyLog whereType($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\MoneyLog whereUpdatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\MoneyLog whereUserId($value)
 * @mixin \Eloquent
 * @property string|null $money_no
 * @property-read \App\Models\User $user
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\MoneyLog whereMoneyNo($value)
 * @property string|null $pay_at
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\MoneyLog wherePayAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\MoneyLog wherePayStaus($value)
 * @property int|null $pay_status
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\MoneyLog wherePayStatus($value)
 */
class MoneyLog extends Model
{


    protected $table = 'money_log';
    protected $dates = [
        'created_at',
        'updated_at',
        'pay_at'
    ];

    protected $guarded = [];

    public function user()
    {
        return $this->hasOne('\App\Models\User', 'id', 'user_id');
    }
    public function buy()
    {
        return $this->hasOne('\App\Models\User', 'id', 'buy_user');
    }
}
